package com.xinyi.httpdemo.model;

import com.xinyi.httpdemo.config.OkHttpConfig;

import java.util.HashMap;
import java.util.Set;

/**
 * @author 杨耿雷
 * @date 2024/9/24 11:12
 * @description 请求参数封装
 */
public final class HttpParams {

    /**
     * 请求参数存放集合
     */
    private final HashMap<String, Object> paramsMap = new HashMap<>(OkHttpConfig.getInstance().getParams());

    public void put(String key, Object value) {
        if (key == null || value == null) {
            return;
        }
        paramsMap.put(key, value);
    }

    public void remove(String key) {
        if (key == null) {
            return;
        }
        paramsMap.remove(key);
    }

    public Object get(String key) {
        return paramsMap.get(key);
    }

    public void clear() {
        paramsMap.clear();
    }

    public boolean isEmpty() {
        return paramsMap.isEmpty();
    }

    public Set<String> getKeys() {
        return paramsMap.keySet();
    }

    public HashMap<String, Object> getParamsMap() {
        return paramsMap;
    }
}